home *** CD-ROM | disk | FTP | other *** search
- Path: news.ruhr-uni-bochum.de!usenet
- From: Karsten Soete <Karsten.Soete@rz.ruhr-uni-bochum.de>
- Newsgroups: comp.lang.c
- Subject: Re: strncpy() ?
- Date: 21 Apr 1996 16:42:33 GMT
- Organization: Ruhr-Universitaet Bochum, Rechenzentrum
- Message-ID: <4ldohp$6e7@sun168.rz.ruhr-uni-bochum.de>
- NNTP-Posting-Host: dialslip-31.rz.ruhr-uni-bochum.de
-
- lonewolf@athena.compulink.gr (Costas Vlassis) schreibt:
- >
- > Well I have this question, let's say we have the following :
- >
- > char alfa[40] = "1123";
- > char beta[20];
- > char gama[20];
- >
- > With strncpy(beta,alfa,2) beta = "11" that's fine but HOW can I make
- > gama = "23" that is the last 2 characters of alfa or even "3" the last
- > character... Is there a function that takes start and end as strings ?
- >
- > what I want is something like :
- >
- > strncpy2 (beta,alfa,2,4);
- >
- > is this possible ?
- >
- > Costas Vlassis
- > lonewolf@compulink.gr
- >
-
- Hello!
-
- There is no such function implemented at the time, but it's
- possible.
- Try
- for(int i=0;i<2;i++) beta[i]=alpha[i+2];
-
- Greetings, AnimalOnLine.
-